package xyz.thoughtset.viewer.executor.blocks.executor;

import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.stereotype.Component;
import xyz.thoughtset.viewer.common.exc.exceptions.ExecException;
import xyz.thoughtset.viewer.modules.step.entity.BlockTypeEnum;
import xyz.thoughtset.viewer.modules.step.entity.SingleBody;
import xyz.thoughtset.viewer.modules.step.entity.block.BlockInfo;

import java.util.Map;

@Component
public class SingleBlockExecutor extends AbstractBlockExecutor<SingleBody> {

    @Override
    protected void init() {
        ExecutorRegistry.setDefault(this);
    }

    @Override
    BlockTypeEnum getSupportType() {
        return BlockTypeEnum.SINGLE;
    }

    @Override
    protected Object doQuery(BlockInfo block, SingleBody baseBlockBody, Map<String, Object> params, ExpressionParser parser, StandardEvaluationContext context) throws ExecException {
        return execNode(baseBlockBody.getNode(), params, parser, context);
    }



}
